package burubaka.model;

import java.io.Serializable;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;
import org.slim3.datastore.json.Json;

import com.google.appengine.api.datastore.Key;

@Model(schemaVersion = 1)
public class TotalResult implements Serializable {

	private static final long serialVersionUID = 1L;

	@Attribute(primaryKey = true, json = @Json(ignore = true))
	private Key key;

	@Attribute(version = true, json = @Json(ignore = true))
	private Long version;

	private long wager = 0;// 賭け金
	private long withdrawal = 0;// 回収
	private String withdrawalOrder;// 回収額順位
	private String lastWithdrawalOrder;// 前回回収額順位
	private double withdrawalRate = 0;// 回収率
	private String withdrawalRateOrder;// 回収率順位
	private String lastWithdrawalRateOrder;// 前回回収率順位
	private int bets = 0;// 投票数
	private int hit = 0;// 的中
	private String hitOrder;// 的中順位
	private String lastHitOrder;// 前回的中順位
	private double hitRate = 0;// 的中率
	private String hitRateOrder;// 的中率順位
	private String lastHitRateOrder;// 前回的中率順位
	private String year;// 年度

	/**
	 * Returns the key.
	 * 
	 * @return the key
	 */
	public Key getKey() {
		return key;
	}

	/**
	 * Sets the key.
	 * 
	 * @param key
	 *            the key
	 */
	public void setKey(Key key) {
		this.key = key;
	}

	/**
	 * Returns the version.
	 * 
	 * @return the version
	 */
	public Long getVersion() {
		return version;
	}

	/**
	 * Sets the version.
	 * 
	 * @param version
	 *            the version
	 */
	public void setVersion(Long version) {
		this.version = version;
	}

	public long getWager() {
		return wager;
	}

	public void setWager(long wager) {
		this.wager = wager;
	}

	public long getWithdrawal() {
		return withdrawal;
	}

	public void setWithdrawal(long withdrawal) {
		this.withdrawal = withdrawal;
	}

	public String getWithdrawalOrder() {
		return withdrawalOrder;
	}

	public void setWithdrawalOrder(String withdrawalOrder) {
		this.withdrawalOrder = withdrawalOrder;
	}

	public String getLastWithdrawalOrder() {
		return lastWithdrawalOrder;
	}

	public void setLastWithdrawalOrder(String lastWithdrawalOrder) {
		this.lastWithdrawalOrder = lastWithdrawalOrder;
	}

	public double getWithdrawalRate() {
		return withdrawalRate;
	}

	public void setWithdrawalRate(double withdrawalRate) {
		this.withdrawalRate = withdrawalRate;
	}

	public String getWithdrawalRateOrder() {
		return withdrawalRateOrder;
	}

	public void setWithdrawalRateOrder(String withdrawalRateOrder) {
		this.withdrawalRateOrder = withdrawalRateOrder;
	}

	public String getLastWithdrawalRateOrder() {
		return lastWithdrawalRateOrder;
	}

	public void setLastWithdrawalRateOrder(String lastWithdrawalRateOrder) {
		this.lastWithdrawalRateOrder = lastWithdrawalRateOrder;
	}

	public int getBets() {
		return bets;
	}

	public void setBets(int bets) {
		this.bets = bets;
	}

	public int getHit() {
		return hit;
	}

	public void setHit(int hit) {
		this.hit = hit;
	}

	public String getHitOrder() {
		return hitOrder;
	}

	public void setHitOrder(String hitOrder) {
		this.hitOrder = hitOrder;
	}

	public String getLastHitOrder() {
		return lastHitOrder;
	}

	public void setLastHitOrder(String lastHitOrder) {
		this.lastHitOrder = lastHitOrder;
	}

	public double getHitRate() {
		return hitRate;
	}

	public void setHitRate(double hitRate) {
		this.hitRate = hitRate;
	}

	public String getHitRateOrder() {
		return hitRateOrder;
	}

	public void setHitRateOrder(String hitRateOrder) {
		this.hitRateOrder = hitRateOrder;
	}

	public String getLastHitRateOrder() {
		return lastHitRateOrder;
	}

	public void setLastHitRateOrder(String lastHitRateOrder) {
		this.lastHitRateOrder = lastHitRateOrder;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((key == null) ? 0 : key.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		TotalResult other = (TotalResult) obj;
		if (key == null) {
			if (other.key != null) {
				return false;
			}
		} else if (!key.equals(other.key)) {
			return false;
		}
		return true;
	}
}
